﻿--lua script
--VIP 相关的脚本处理   
--#include "data\functions\Vip\VipCommon.lua" once
--#include "data\functions\Vip\ConcVipCommon.lua" once
--#include "data\functions\Vip\ConcVipBoss.lua" once
--#include "data\functions\Vip\SuperVipCommon.lua" once
--[[
//VIP的相关操作
enum tagVipOP
{
	gVipGradeChanged	= 1,				//VIP等级变化
	gVipGetGradeGift	= 2,				//领取VIP礼包
	gVipGetData			= 3,				//获取VIP数据
	gBuyConcVip			= 4,				//购买或续费并行VIP（特权）
	gGetConcVipGift		= 5,				//领取并行VIP（特权）礼包
	gVipEnterBoss		= 6,				//进入VIP BOSS
	gConcVipEnterBoss   = 7,				//进入月卡Boss
	gBuySuperVip		= 8,				//购买至尊特权
};
]]

VipOpFuncList = {}


EventCallDispatcher.HandlerVipOp = function (sysarg, args)
	if args[1] == nil then 
 		return 
 	end   --第1个参数
 	local func = VipOpFuncList[args[1]]
 	if func ~= nil then
 		return func(sysarg, args)
 	end
end

--[[VIP等级变化了
PROP_VIP_GRADE属性已经设置
]]
VipOpFuncList[gVipGradeChanged] = function (sysarg,args)
	local oldVipGrade = args[2]
	local newVipGrade = args[3]
	OnVipGradeChanged( sysarg, oldVipGrade, newVipGrade )
end

--[[
领取VIP等级礼包
]]
VipOpFuncList[gVipGetGradeGift] = function (sysarg,args)
	local gradeGiftIdx = args[2]
	GetVipGradeGift( sysarg, gradeGiftIdx )
end

--[[
下发VIP数据
]]
VipOpFuncList[gVipGetData] = function (sysarg,args)
	SendVipGiftData( sysarg )
	SendVipBossData( sysarg )
	SendConcVipBossData(sysarg)
end

--[[
购买或续费并行VIP（特权）
]]
VipOpFuncList[gBuyConcVip] = function (sysarg,args)
	local opType 	= args[2]
	local vipType 	= args[3]
	--print("gBuyConcVip, opType="..opType..", vipType="..vipType)
	if opType == 0 then					--团购
		BuyAllConcVip( sysarg )
	elseif opType == 1 then				--购买
		BuyConcVip( sysarg, vipType )
	else 								--续费
		RenewalConcVip( sysarg, vipType )
	end
end

--[[
领取特权礼包
]]
VipOpFuncList[gGetConcVipGift] = function (sysarg,args)
	local vipType = args[2]
	GetConcVipGift( sysarg, vipType )
end

--[[
进入VIP BOSS
]]
VipOpFuncList[gVipEnterBoss] = function (sysarg,args)
	local vipGrade = args[2]
	EnterVipBoss( sysarg, vipGrade )
end


--[[
进入月卡 BOSS
]]
VipOpFuncList[gConcVipEnterBoss] = function (sysarg,args)
	local vipType = args[2]
	EnterConcVipBoss( sysarg, vipType )
end

VipOpFuncList[gBuySuperVip] = function (sysarg,args)
	BuySuperVip(sysarg)
end

EventCallDispatcher.registerEventCall( aeVip, EventCallDispatcher.HandlerVipOp )
